/*******************************************************************************
 *
 *    Copyright (c) Baina Info Tech Co. Ltd
 *
 *    BookmarksWidget
 * 
 *    MusicWidgetProvider
 *    TODO File description or class description.
 *
 *    @author: dhu
 *    @since:  Apr 14, 2010
 *    @version: 1.0
 *
 ******************************************************************************/
package small.hero.entertaiment.radio.jiujie.version.zl.widget;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;

/**
 * MusicWidgetProvider of BookmarksWidget.
 * 
 * @author dhu
 * 
 */
public class MusicWidgetProvider extends AppWidgetProvider {

	public static final Uri BOOKMARKS_URI = Uri
			.parse("content://browser/bookmarks");

	static final String BROCASET_UPDATE_WIDGET_PREVIOUS = "updatewidgetpre";
	static final String BROCASE_UPDATE_WIDGET_NEXT = "updatewidgetnext";
	static final String BROCASE_CHANGE_BOOKMAARK_ODER = "changebookmarkorder";

	public static final String ACTION_UPDATE_WIDGET = "com.tool.quick.dialer.data.update";

	@Override
	public void onReceive(Context context, Intent intent) {
		// if
		// (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(intent.getAction()))
		// {
		// super.onReceive(context, intent);
		// } else if (intent.getAction().equals(ACTION_UPDATE_WIDGET)) {
		//
		// // updateWidget(context);
		// }
	}

	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager,
			int[] appWidgetIds) {
		// updateWidget(context);
	}

	// public static void updateWidget(Context context) {
	// final RemoteViews views = buildUpdate(context);
	// final ComponentName thisWidget = new ComponentName(context,
	// MusicWidgetProvider.class);
	// final AppWidgetManager gm = AppWidgetManager.getInstance(context);
	// gm.updateAppWidget(thisWidget, views);
	// }

	// static RemoteViews buildUpdate(Context context) {
	// // final RemoteViews views = new RemoteViews(context.getPackageName(),
	// // R.layout.widget);
	// // views.setViewVisibility(LAYOUT_TUNNY_INSTALLED_ID, View.VISIBLE);
	// // updateViews(context, views);
	// // return views;
	// }

	private static void updateViews(Context context, RemoteViews remoteViews) {
		// SharePreferenceManager mSharePreferenceManager = new
		// SharePreferenceManager(
		// context);
		// for (int i = 0; i < 6; i++) {
		// final int id = THUMBNAIL_IDS[i];
		// final int titleId = TITLE_IDS[i];
		// String userName = mSharePreferenceManager.getConctactName(i);
		// String userNumber = mSharePreferenceManager.getConctactNumber(i);
		// int userIconID = mSharePreferenceManager.getConctactIcon(i);
		// remoteViews.setViewVisibility(id, View.VISIBLE);
		// remoteViews.setTextViewText(titleId, userName);
		// if (userIconID == 0) {
		// remoteViews.setImageViewResource(id, dialerResoucrID[i]);
		// } else {
		// remoteViews.setImageViewResource(id, userIconID);
		// }
		//
		// Uri uri = Uri.parse("tel:" + userNumber);
		// Intent intent = new Intent(Intent.ACTION_CALL);
		// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		// intent.setData(uri);
		// // Intent intent = new Intent(context, Settings.class);
		// final PendingIntent pendingIntent = PendingIntent.getActivity(
		// context, 0, intent, 0);
		// remoteViews.setOnClickPendingIntent(id, pendingIntent);
		// }
	}

}
